﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<title>设置显示区域</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<script type="text/javascript" src="proj/resources/javascript/jquery/jquery-1.5.2.min.js"></script>
	<script type="text/javascript" src="proj/resources/javascript/flashmap/flashmap_all.js"></script>
    <script type="text/javascript">
        $(function(){
			$("body").prepend($("<a>").attr("href","http://code.google.com/p/njcjtx/source/browse/trunk/samples/"+$("title").text()+".html").attr("target","blank").text("查看页面源码(Google Code)"));
			
            var onMapLoadHandler = function(){
                //设置当前显示区域
                map.extent([13199146.044280795, 3697106.1840964477, 13705159.17152842, 3843865.278403916]);
            };
            
            map = new iMap({
                dom:"flashContent",
                type:"street",
                width:"100%",
                height:480,
                onLoad:onMapLoadHandler
            });
            
            $("#btnGetExt").click(function(){
                $("#console").text(" >> "+map.extent());
            });
            
            $("#btnSetExt").click(function(){
                map.extent([13199146.044280795, 3697106.1840964477, 13705159.17152842, 3843865.278403916]);
            });
            
        });
    </script>
	</head>
	<body>
		<div id="flashContent" style="border:solid 1px;postion:absolute;"></div>
        <div id="demo" style="postion:absolute;">
            <p>设置显示区域:</p>         
            <fieldset>
                <legend><input id="btnSetExt" type="button" value="执行代码"></input></legend>
                <code>map.extent([13199146.044280795, 3697106.1840964477, 13705159.17152842, 3843865.278403916]);</code>
            </fieldset>
            <p>注:如何获取显示区域?</p>
            <fieldset>
                <legend><input id="btnGetExt" type="button" value="执行代码"></input></legend>
                <code>map.extent();//获取当前显示区域</code><code id="console" style="color:#00ff00;"></code>
            </fieldset>
        </div>
	</body>
</html>
